
public class Borrower extends User{
	public Borrower(String name, int book) throws NotALenderException {
		super(name, book);
		if(book < 0){
			throw new NotALenderException("A new borrower cannot lend books");
		}

	}

	@Override
	public void moreBook(int number) throws NotALenderException {
		if((getBook() + number) >= 0) {
			setBook(getBook() + number);
		}else {
			throw new NotALenderException("A borrower cannot lend " + -(getBook() + number) + " book(s).");
		}
		
	}
	public static void testBorrower(){
		try{
			Borrower b = new Borrower("Bob",-1);
		} catch(NotALenderException e){
			System.out.println(e.getMessage().equals("A new borrower cannot lend books."));
		}
		try{
			Borrower b = new Borrower("Bob",10);
			System.out.println(b.getName()=="Bob");
			System.out.println(b.getBook()==10);
			b.setBook(5);
			System.out.println(b.getBook()==5);
			b.moreBook(2);
			System.out.println(b.getBook()==7);
			b.moreBook(-2);
			System.out.println(b.getBook()==5);
			b.moreBook(-5);
			System.out.println(b.getBook()==0);
			b.moreBook(-1);
		} catch(NotALenderException e){
			System.out.println(e.getMessage().equals("A borrower cannot lend 1 book(s)."));
		}
	}


}
